package webEquipeRechercheGwt.client.handler.creation.entity;

import webEquipeRechercheGwt.client.callback.creation.CallBackSeminarCreationAndModification;
import webEquipeRechercheGwt.client.entityCreationPanel.SeminarCreationPanel;
import webEquipeRechercheGwt.client.services.SeminarService;
import webEquipeRechercheGwt.client.services.SeminarServiceAsync;
import webEquipeRechercheGwt.client.structure.DataShowingPanel;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class ClickHandlerSeminarCreation  implements ClickHandler {

	SeminarCreationPanel creationPanel;
	DataShowingPanel mainPanel;
	
	public ClickHandlerSeminarCreation(SeminarCreationPanel creationPanel,DataShowingPanel mainPanel) {
		super();
		this.creationPanel = creationPanel;
		this.mainPanel = mainPanel;
	}

	@Override
	public void onClick(ClickEvent event) {
		SeminarServiceAsync service = GWT.create(SeminarService.class);
		AsyncCallback<Boolean> callback = new CallBackSeminarCreationAndModification(mainPanel);
		service.createSeminar(creationPanel.getMirror(), callback);
	}

}
